<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <base href="<%=basePath%>">   
  <title>My JSP 'listNews.JSP' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="js/jquery.min.js"></script>

	<script type="text/javascript" src="js/jquery.quickpaginate.js"></script>
		<script type="text/javascript" src="js/jquery.quickpaginate.packed.js"></script>
	<style type="text/css" media="screen">
		
			html, body, div, span, applet, object, iframe,
			h1, h2, h3, h4, h5, h6, p, blockquote, pre,
			a, abbr, acronym, address, big, cite, code,
			del, dfn, em, font, img, ins, kbd, q, s, samp,
			small, strike, strong, sub, sup, tt, var,
			dl, dt, dd, ol, ul, li,
			fieldset, form, label, legend,
			table, caption, tbody, tfoot, thead, tr, th, td {
				margin: 0; padding: 0; border: 0; font-weight: inherit;
				font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; }
			a img,:link img,:visited img { border:none }
			body { line-height: 1.5; font-family: Arial, Helvetica, Verdana, sans-serif; color: #333; font-size: 75%;}
			html > body   { font-size: 12px; padding: 20px }  
			h1 { font-size: 2.0em; font-weight: normal; margin: 0.6em 0em 0.8em 0em; padding: 0em; }
			h2 { font-size: 1.4em; margin: 1.2em 0em 1.2em 0em; font-weight: normal; }
			h3 { font-size: 1.2em; margin: 1.2em 0em 1.2em 0em; font-weight: normal; }
			ol, ul, li { font-size: 1.0em; }
			p { font-size: 1.0em; line-height: 1.6em; margin: 1.0em 0em 1.0em 0em; }
			pre, code { font-family: monospace; font-size: 1.0em; }
			
			p { color: #444; }
			a:link, a:hover, a:visited { color: #015C8A; }
			#page { padding: 20px 20px; }
			h1 { font-family: "helvetica neue", helvetica, arial, verdana, sans-serif; color: #999; border-bottom: 1px solid #999; padding-bottom: 5px;
			margin-top: 0; }
			h1 a { text-decoration: none; color: #999 !important; }
			h1 a:hover { text-decoration: underline; }
			h1 span { color: #444; }
			h2 { font-family: "helvetica neue", helvetica, arial, verdana, sans-serif; border-bottom: 1px solid #CCC; padding-bottom: 5px; margin-bottom:
			0.9em; color: #444; }
			h3 { font-family: "helvetica neue", helvetica, arial, verdana, sans-serif; color: #444; margin-top: 1.0em; font-weight: bold; }
			#nav { background: #333; padding: 7px 20px; }
			#nav a { color: #FFB900; text-decoration: none; }
			#nav a:hover { text-decoration: underline; }
			code { font-weight: normal !important; }
			li { margin-left: 16px; width: 100%}
			strong { font-weight: bold }

		
			#shopping_list {
				margin: 0 0 10px 0;
				padding: 0 14px;
			}			
		
			.qp_counter {
				margin:  10px;
			}
			
			pre {
				margin: 20px 0 10px 0;
				background: #ccc !important;
				padding: 10px;
			}
			
			a.qp_disabled {
				color: #888;
			}	
		</style>
  </head>
  
  <body>
    This is my listNews page. <br>
    <hr>
    <ul>
    <li><a href="index.jsp">发布新闻页</a></li>
    <li><a href="listNews.jsp">新闻列表页</a></li>
    </ul>
    <ul id="shopping_list"></ul>
   <div id="shopping_list_counter"></div>
    <script type="text/javascript"> 
    var flag=0;
    var i=0;
    var title;
	$.ajax({
   		url: "showNewsAction.do",
   		type:'jsonp',
   		async: false,
   		success: function(msg){
			for(i=0;i<msg.toString().length;i++){
	     		$("#shopping_list").append("<li><a href="+"http://localhost:8080/HCF/showNews.jsp?id="
	     			+msg.news[i].id
	     			+">"
	     			+i
	     			+msg.news[i].id
	     			+msg.news[i].title
	     			+msg.news[i].author
	     			+msg.news[i].date.toString()
	     			+"</a>"+"--------"
	     			+"<a href=delNewsAction.do?id="+msg.news[i].id+">删除</a>"
	     			+"</li>"
	     			);
	     	}	
		}
	});

</script>
<script type="text/javascript">
	$("#shopping_list li").quickpaginate({ perpage:5, pager : $("#shopping_list_counter") });
</script>

</body>
</html>

